﻿@model DHQGHN.PM0.Models.LoginViewModel
@using BotDetect.Web.UI.Mvc
@{
    ViewBag.Title = "Đăng nhập";
    Layout = "~/Views/Shared/_Layout.cshtml";
    MvcCaptcha pm0Captcha = new MvcCaptcha("PM0Captcha");

    int Count = (int)Session["LoginTime"];
    //if (Model.LoginTime > 2)
    //{
    //    actionName = "LoginWithCaptcha";
    //}
    
}
<link href="~/Content/bootstrap.css" rel="stylesheet" />
<link href="~/Content/bootstrap-theme.min.css" rel="stylesheet" />
<link href="~/Content/bootstrap-theme.css" rel="stylesheet" />
<link href="~/Content/Site.css" rel="stylesheet" />
<link href="@BotDetect.Web.CaptchaUrls.Absolute.LayoutStyleSheetUrl" rel="stylesheet" type="text/css" />
<style type="text/css">
    .validation-summary-errors {
        color: red;
    }
</style>
<div style="text-align: center; ">
    <div style="width: 30%; min-width: 300px; background: #fff; display: inline-block; border-top: 5px solid #3276b1; box-shadow: 4px 4px 2px #888888; background-color: rgba(255,255,255,0.6);">
        <section id="loginForm">
            @using (Html.BeginForm("Login", "Login", new { ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { @id = "login-form", role = "form" }))
            {
                @Html.AntiForgeryToken()
                <h4 style="text-transform:uppercase; text-align:center; padding-top:10px">
                    <span>
                        <img style="width:60px;height:60px;margin-right:10px" src="~/Images/user_admin_gear.png" />
                    </span>
                    Đăng nhập hệ thống
                </h4>
                <hr />
                @Html.ValidationSummary(false)
                <div style="margin:auto">
                    <div style="text-align: center;">
                        @Html.TextBoxFor(m => m.UserName, new { @class = "TextBoxContent-login", @style = "width:60%;", @placeholder = "Tên đăng nhập" })
                    </div>
                </div>
                <div>
                    <div style="text-align:center">
                        @Html.PasswordFor(m => m.Password, new { @class = "TextBoxContent-login", @style = "width:60%;", @placeholder = "Mật khẩu" })
                    </div>
                </div>
                <input type="hidden" value="@Session["LoginTime"]" name="LoginTime" />
                if (Count > 2)
                {
                    <div class="form-group">
                        <span class="validation-summary-errors">Vui lòng nhập Captcha</span>
                        <div>
                            <center>@Html.Captcha(pm0Captcha)</center>
                            <br />
                            @Html.TextBox("CaptchaCode", "", new { @class = "TextBoxContent-login", @style = "width:60%;", @placeholder = "Mã bảo mật" })
                        </div>
                    </div>
                }
                <div class="form-group">
                    <div style="text-align:center">
                        <input type="submit"  value="Đăng nhập" class="btn btn-primary" style="background:#3276b1;" />
                    </div>
                </div>
            }
            <a href="~/Login/AccountForgetPass" style="color:#0983EC">Quên mật khẩu </a>
        </section>
    </div>

</div>
@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")

}
<script>
    setTimeout(function () { $('#login-form').find('input:text:visible:first').focus(); }, 500);

</script>